Skip to content

Fix nil pointer panic in verifyDisabledVFs for non-SR-IOV GPUs#1186

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
Miaoxiang-philips:fix/vfio-nil-pointer-panic
Jun 11, 2026
Merged

Fix nil pointer panic in verifyDisabledVFs for non-SR-IOV GPUs#1186
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
Miaoxiang-philips:fix/vfio-nil-pointer-panic

Conversation

@Miaoxiang-philips

Copy link
Copy Markdown
Contributor

GPUs that do not support SR-IOV (e.g. NVIDIA T400) have SriovInfo.PhysicalFunction set to nil. The existing code dereferences PhysicalFunction.NumVFs without a nil check, causing a panic when VFIO passthrough is configured for such GPUs.

Add nil checks for both the gpu return value and PhysicalFunction. A nil PhysicalFunction means no VFs can exist, so it is safe to proceed.

What type of PR is this?

/kind bug

What this PR does / why we need it:

fix #1185

Which issue(s) this PR is related to:

Special notes for your reviewer:

Does this PR introduce a user-facing change?


Additional documentation (design docs, usage docs, etc.):


Checklist

  • make check test passes locally
  • make check-generate passes if api/ changed (CRDs, deepcopy, informers, listers, clientset)
  • make check-modules passes if go.mod / go.sum changed
  • Tests added or updated for the change
  • Helm chart (deployments/helm) updated if flags, RBAC, or defaults changed

GPUs that do not support SR-IOV (e.g. NVIDIA T400) have
SriovInfo.PhysicalFunction set to nil. The existing code dereferences
PhysicalFunction.NumVFs without a nil check, causing a panic when VFIO
passthrough is configured for such GPUs.

Add nil checks for both the gpu return value and PhysicalFunction. A nil
PhysicalFunction means no VFs can exist, so it is safe to proceed.

Signed-off-by: Miaoxiang <miaoxiang.philips@gmail.com>
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 10, 2026
@netlify

netlify Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deploy Preview for dra-driver-nvidia-gpu canceled.

Name Link
🔨 Latest commit ba3170b
🔍 Latest deploy log https://app.netlify.com/projects/dra-driver-nvidia-gpu/deploys/6a292815591f070008e8f976

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 10, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Miaoxiang-philips / name: WANG, Miaoxiang (ba3170b)

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Welcome @Miaoxiang-philips!

It looks like this is your first PR to kubernetes-sigs/dra-driver-nvidia-gpu 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/dra-driver-nvidia-gpu has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 10, 2026
@k8s-ci-robot k8s-ci-robot requested a review from jgehrcke June 10, 2026 09:02
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @Miaoxiang-philips. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot requested a review from klueska June 10, 2026 09:02
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 10, 2026
@shivamerla

Copy link
Copy Markdown
Contributor

/assign @varunrsekar

@shivamerla

Copy link
Copy Markdown
Contributor

@Miaoxiang-philips Thanks for proposing this fix. Please sign the CLA.

@varunrsekar varunrsekar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks for fixing this.

/skip-tests
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 10, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 2fce439c8bf922346668d885ec0d3557ffcd1b71

@varunrsekar

Copy link
Copy Markdown
Contributor

/hold
/release-note-none
/skip tests

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 10, 2026
@Miaoxiang-philips

Copy link
Copy Markdown
Contributor Author

Hi @shivamerla I have signed the CLA

@varunrsekar

Copy link
Copy Markdown
Contributor

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 11, 2026
@shivamerla

Copy link
Copy Markdown
Contributor

/approve

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Miaoxiang-philips, shivamerla

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 11, 2026
@shivamerla

Copy link
Copy Markdown
Contributor

/cherry-pick release-0.4

@k8s-ci-robot k8s-ci-robot merged commit 749a743 into kubernetes-sigs:main Jun 11, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in DRA Driver for NVIDIA GPUs Jun 11, 2026
@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@shivamerla: once the present PR merges, I will cherry-pick it on top of release-0.4 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-0.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@shivamerla: new pull request created: #1194

Details

In response to this:

/cherry-pick release-0.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: verifyDisabledVFs panics with nil pointer dereference on GPUs without SR-IOV support

5 participants